import { createRouter, createWebHistory } from 'vue-router'

const routes = [
	{
		path: '/',
		name: 'Home',
		hidden: true,
		component: () => import('../views/Home.vue'),
	},
	{
		path: '/setup',
		name: 'setup',
		component: () => import('../views/setup/index.vue'),
	},
	{
		path: '/model',
		name: 'model',
		component: () => import('../views/v-model/index.vue'),
	},
	{
		path: '/emit',
		name: 'emit',
		component: () => import('../views/emit/index.vue'),
	},
	{
		path: '/ref',
		name: 'ref',
		component: () => import('../views/ref/index.vue'),
	},
	{
		path: '/toRef',
		name: 'toRef',
		component: () => import('../views/toRef/index.vue'),
	},
	{
		path: '/reactive',
		name: 'reactive',
		component: () => import('../views/reactive/index.vue'),
	},
	{
		path: '/bind',
		name: 'bind',
		component: () => import('../views/bind/index.vue'),
	},
	{
		path: '/props',
		name: 'props',
		component: () => import('../views/props/index.vue'),
	},
	{
		path: '/attrs',
		name: 'attrs',
		component: () => import('../views/attrs/index.vue'),
	},
	{
		path: '/mixins',
		name: 'mixins',
		component: () => import('../views/mixins/index.vue'),
	},
	{
		path: '/pinia',
		name: 'pinia',
		component: () => import('../views/pinia/index.vue'),
	},
	{
		path: '/provide-inject',
		name: 'provide-inject',
		component: () => import('../views/provide-inject/index.vue'),
	},
	{
		path: '/SFC',
		name: 'SFC',
		component: () => import('../views/SFC/index.vue'),
	},
	{
		path: '/hook',
		name: 'hook',
		component: () => import('../views/hook/index.vue'),
	},
	{
		path: '/Suspense',
		name: 'Suspense',
		component: () => import('../views/Suspense/index.vue'),
	},
	{
		path: '/teleport',
		name: 'teleport',
		component: () => import('../views/teleport/index.vue'),
	},
	{
		path: '/TS',
		name: 'TS',
		component: () => import('../views/TS/index.vue'),
	},
	{
		path: '/script-setup',
		name: 'script-setup',
		component: () => import('../views/script-setup/index.vue'),
	},
	{
		path: '/mitt',
		name: 'mitt',
		component: () => import('../views/plugins/mitt/index.vue'),
	},
	{
		path: '/directive',
		name: 'directive',
		component: () => import('../views/directive/index.vue'),
	},
	{
		path: '/prop-attr',
		name: 'prop-attr',
		component: () => import('../views/prop-attr/index.vue'),
	},
	{
		path: '/watch',
		name: 'watch',
		component: () => import('../views/watch/index.vue'),
	},
	{
		path: '/component',
		name: 'component',
		component: () => import('../views/component/index.vue'),
	},
	{
		path: '/custom-plugins',
		name: 'custom-plugins',
		component: () => import('../views/custom-plugins/index.vue'),
	},
	{
		path: '/transition',
		name: 'transition',
		component: () => import('../views/transition/index.vue'),
	},
	{
		path: '/css',
		name: 'css',
		component: () => import('../views/css/index.vue'),
	},
	{
		path: '/VueUse',
		name: 'VueUse',
		component: () => import('../views/VueUse/index.vue'),
	},
]

const router = createRouter({
	history: createWebHistory(), // 设置baseUrl 。 不传 或 process.env.BASE_URL默认都是'/'
	routes,
})

export function resetRouter() {
	const newRouter = router
	;(router as any).matcher = (newRouter as any).matcher // reset router
}

export default router
